'use strict'

// 初始化数据脚本
async function main() {
    const mongoose_service = require('../src/services/mongoose')
    await mongoose_service.lift();

    const {MenuModel} = require('../src/models/');

    let menuList = [
        {"code": "137054","disable": 1,"parent_code": "","name": "首页","path": "/dashboard","order": 0},
        {"code": "111321","disable": 1,"parent_code": "","path": "/system","name": "系统设置","order": 100},
        {"code": "241615","disable": 1,"parent_code": "111321","name": "菜单管理","path": "menuList","order": 0},
        {"code": "210338","disable": 1,"parent_code": "111321","path": "roleList","name": "角色管理","order": 1},
        {"code": "223739","disable": 1,"parent_code": "111321","name": "后台用户管理","path": "adminUserList","order": 2},
        {"code": "187599","disable": 1,"parent_code": "","order": 15,"path": "/setting","name": "设置"},
        {
          "code": "221254",
          "disable": 1,
          "parent_code": "187599",
          "path": "banner",
          "name": "轮播图管理",
          "order": 1,
        },{
          "code": "147015",
          "disable": 1,
          "parent_code": "",
          "name": "企业管理",
          "path": "/enterprise",
          "order": 15,
        },{
          "code": "147020",
          "disable": 1,
          "parent_code": "",
          "name": "储存柜",
          "path": "/cabinet",
          "order": 20,
        },{
          "code": "147025",
          "disable": 1,
          "parent_code": "",
          "name": "设备管理",
          "path": "/equipment",
          "order": 25,
        },{
          "code": "147030",
          "disable": 1,
          "parent_code": "",
          "name": "设备日志",
          "path": "/equipmentLog",
          "order": 30,
        },{
          "code": "272360",
          "disable": 1,
          "parent_code": "187599",
          "name": "信息设置",
          "path": "info",
          "order": 3,
        }
    ];
    for(var i = 0, l = menuList.length; i < l; i++){
        let menu = menuList[i];
        await MenuModel.create(menu);
    }

		
    await mongoose_service.lower();
}


main().catch((error) => {
    console.error(error)
    process.exit(1)
})

